apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: ${app_name}
  name: ${app_name}
  namespace: ${namespace}
spec:
  replicas: ${replicas}
  selector:
    matchLabels:
      app: ${app_name}
  template:
    metadata:
      annotations:
        prometheus.io/path: /prometheus
        prometheus.io/port: "8763"
        prometheus.io/scrape: "true"
      labels:
        app: ${app_name}
    spec:
      containers:
      - env:
        - name: PAAS_APP_NAME
          value: ${app_name}
        - name: PAAS_NAMESPACE
          value: ${namespace}
        - name: PAAS_PROJECT_ID
          value: 08b554146200f2d02f21c016b9c77af3
        - name: PAAS_MONITORING_GROUP
          value: access${env}
        - name: JAVA_TOOL_OPTIONS
          value: -javaagent:/paas-apm/collectors/pinpoint/pinpoint-bootstrap.jar -Dpinpoint.config=/paas-apm/collectors/pinpoint/pinpoint.config
            -Duser.stemming.config=/paas-apm/collectors/pinpoint/userStemming.config
        - name: PAAS_CLUSTER_ID
          value: 6e199c41-bc1c-11ea-bbd4-0255ac1000c6
        image: swr.cn-east-3.myhuaweicloud.com/access/${app_name}:master.20200731145524
        imagePullPolicy: Always
        name: ${app_name}
        ports:
        - containerPort: 8080
          protocol: TCP
        resources:
          limits:
            cpu: "2"
            memory: 4Gi
           # ephemeral-storage: "0Gi"
          requests:
            cpu: "2"
            memory: 4Gi
           # ephemeral-storage: "50Gi"
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /paas-apm/collectors/pinpoint/
          name: paas-apm
        - mountPath: /data/logs
          name: log-dir
          policy:
            logs:
              annotations:
                pathPattern: ""
              rotate: Hourly
        readinessProbe:
          httpGet:
            path: /actuator/health
            port: 8080
        lifecycle:
          preStop:
            exec:
              command:
              - /bin/sh
              - sleep 30
      dnsPolicy: ClusterFirst
      imagePullSecrets:
      - name: default-secret
      initContainers:
      - command:
        - sh
        - -c
        - cp -pr /paas-apm/collectors/pinpoint/* /var/init/pinpoint
        image: swr.cn-east-3.myhuaweicloud.com/op_svc_apm/pinpoint:latest
        imagePullPolicy: Always
        name: init-pinpoint
        resources:
          limits:
            cpu: 250m
            memory: 250Mi
          requests:
            cpu: 250m
            memory: 250Mi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/init/pinpoint
          name: paas-apm
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
      - emptyDir: {}
        name: paas-apm
      - emptyDir: {}
        name: log-dir